﻿using AutoMapper;
using J.Model;
using J.ProductSet.Application.Command.ClassifiedManagementCommand;
using MediatR;
using SqlSugar;
using System.Collections.Generic;

namespace J.ProductSet.Application.CommandHandler.ClassifiedManagementCommandHandler
{
    public class ClassifiedManagementDeleteCommandHandler : IRequestHandler<ClassifiedManagementDeleteCommand, int>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public IMapper _mapper;
        public ClassifiedManagementDeleteCommandHandler(ISqlSugarClient sqlSugarClient, IMapper mapper)
        {
            _sqlSugarClient = sqlSugarClient;
            _mapper = mapper;
        }
        public  async Task<int> Handle(ClassifiedManagementDeleteCommand request, CancellationToken cancellationToken)
        {
            var id = request.CategoryManagementID.Split(",");
           var list = await _sqlSugarClient.Deleteable<ClassifiedManagement>(id).ExecuteCommandAsync();
            return list;
        }
    }
}
